package com.aipsi.cws.supplier.util;

import com.aipsi.cws.supplier.domain.Supplier;
import com.aipsi.cws.supplier.dvo.CommonVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import static com.aipsi.cws.supplier.constants.ControllerConstants.DEBT_FILED_NAME;


/**
 * @author 大忽悠
 * @create 2022/4/24 8:58
 */
public class CommonUtil {
    /**
       抽取分页信息，并创建分页对象返回
     */
    public static Page getPage(CommonVO commonVO) {
        return new Page(commonVO.getStartPage(),commonVO.getPageSize());
    }

    /**
      抽取透支金额相关查询条件
     */
    public static QueryWrapper<Supplier> getQueryWrapperOfOverDraftAmount(CommonVO commonVO) {
        return new QueryWrapper<Supplier>()
                .between(DEBT_FILED_NAME,commonVO.getDebtStart()
                ,commonVO.getDebtEnd());
    }
}
